<?php

namespace App\Console;

use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;

class Kernel extends ConsoleKernel
{
    /**
     * The Artisan commands provided by your application.
     *
     * @var array
     */
    protected $commands = [
        Commands\UserRecommdation::class,
        //控糖达标任务
        Commands\TaskSugar::class,
        Commands\GetLoginToken::class,
        Commands\DeleteUnpaidTimeOutOrders::class,
        Commands\SwooleWebSocket::class,

    ];

    /**
     * Define the application's command schedule.
     *
     * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
     * @return void
     */
    protected function schedule(Schedule $schedule)
    {
        $schedule->command('UserRecommdation')->dailyAt('1:00');

            //->hourly();
        //每5分钟跑一次 控糖达标任务
        $schedule->command('task_sugar')->everyFiveMinutes()->runInBackground();
        #每分钟轮询order表 删除未支付且超时的订单
        $schedule->command('delete_unpaid_orders')->everyMinute();
    }

    /**
     * Register the commands for the application.
     *
     * @return void
     */
    protected function commands()
    {
        $this->load(__DIR__.'/Commands');

        require base_path('routes/console.php');
    }
}
